<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>物业管理系统</title>
    <base href="<%=basePath%>"> 
    <link rel="stylesheet" href="css/bootstrap.css">
    <link rel="stylesheet" href="css/vivo.css">
    <link rel="stylesheet" href="css/cmxform.css">
	
	<!-- <script src="js/jquery-1.11.1.js"></script> -->
	<script src="http://libs.baidu.com/jquery/2.1.1/jquery.min.js"></script>
	<script type="text/javascript" src="js/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" src="js/layer/layer/layer.js"></script> 
    <script type="text/javascript" src="js/sharefunction.js"></script>
    <link href="js/select2/select2.min.css" type="text/css" rel="stylesheet" />
	<script src="js/select2/select2.min.js"></script>
	
	<script type="text/javascript">
		
		$(document).ready(function() {
			var s2=$(".js-example-tags").select2();
			initSelectData();
			s2.val("人员巡查").trigger("change");
	       	
			$(".js-example-tags").select2({
				 tags: true
			});
		});
		
		
		function initSelectData(){
			var html = "";
			var arr = ["人员巡查","消防巡查","安全巡查","卫生巡查","水电巡查","超伟巡查"];
			for(var i = 0;i<arr.length;i++){
				html = "<option value=\""+arr[i]+"\">"+arr[i]+"</option>";
				$("#examineContent").append(html);
			}
		}
		
		
		
		
		function change(obj){
			var examine = $(obj).val();
			$("#examine").text(examine);
		}
		
		function saveDocument(){
			var examineDate=$("#examineDate").val();
			var examineContent=$("#examineContent").val();
			var examineRecord=$("#examineRecord").val();
			var isfraud=$("input[name='isfraud']:checked").val();
			var fraudDispose=$("#fraudDispose").val();
			var roomInfoId=$("#roomInfoId").val();
			var fkexaminePerson = '${user.id}';
			var url="project/decorateManager/add";
			$.ajax({
			    type:"post",
			    async:false,
			    url:url,
		        dataType:"json",
		        data:{
		        	examineDates:examineDate,
		        	examineContent:examineContent,
		        	examineRecord:examineRecord,
		        	isfraud:isfraud,
		        	fraudDispose:fraudDispose,
		        	//fkexaminePerson:fkexaminePerson,
		        	roomId:roomInfoId
		        },
			    success:function(responseText){
			        if(responseText.success){
						window.parent.gridObj_1.refreshPage();
			        	window.parent.layer.msg('保存成功！');
			        	closeLayer();
	    			}else{
	    				alert(responseText.msg, {icon: 7});
	    			}
			    }
	   		});
		}
	</script>
	
	</head>
	<body>
		<form class="cmxform" id="commentForm" method="get" action="">
		<div style="padding:20px">
		
		<div class="panel panel-default">
			<div class="panel-heading">
      			<h5 class="panel-title">基本信息</h5>
   			</div>
   			<div class="panel-body">
			<table cellpadding="10" cellspacing="5" class="mytable">
				<tr>
					<td width="90">巡视时间</td>
					<td>
						<input type="text" name="examineDate" id="examineDate" class="Wdate" onClick="WdatePicker({ dateFmt: 'yyyy-MM-dd'})"/> 
						<span></span>
					</td>
				</tr>
				<tr>
					<td width="90">巡视人员</td>
					<td>
						<input type="text" name="fkexaminePerson" id="fkexaminePerson" value="${user.userName}" readonly />
						<span></span>
						
					</td>
				</tr>
				<tr>
					<td width="90">巡视内容</td>
					<td>
						<select  class="js-example-tags" name="examineContent" id="examineContent" style="width:135px;" onchange="change(this)">
						</select>
						
					</td>
				</tr>
				<tr>
					<td width="90" id="examine">人员巡查</td>
					<td>
						<textarea rows="3" cols="70" name="examineRecord" id="examineRecord"></textarea>
						<span></span>
						
					</td>
				</tr>
				<tr>
					<td width="90">是否违规</td>
					<td>
						<input type="radio" name="isfraud" id="isfraud"  value="0" style="cursor:pointer;" checked="checked">否
           		 		<input type="radio" name="isfraud" id="isfraud"  value="1"  style="cursor:pointer;"  >是
					</td>
				</tr>
				<tr>
					<td width="90">违规处理</td>
					<td>
						<textarea rows="3" cols="70" name="fraudDispose" id="fraudDispose"></textarea>
						<span></span>
						
					</td>
				</tr>
			</table>
			</div>
			</div>
			<div style="width:100%;text-align:center; padding-top:20px"> 
				<!-- <button class="btn btn-primary radius" type="submit" > 保 存</button>  -->
				<button class="btn btn-primary radius" onclick="saveDocument()"> 保 存</button>
				 <a class="btn btn-default radius" onClick="closeLayer();"> 取 消 </a> 
	    	</div> 
	    	 <input type="hidden" id="roomInfoId" name="roomInfoId" value="${roomInfoId }"/>
		</div>
		
		</form>
  	</body>
  	
   </html>
  	
